package com.liangfeng.ysdemo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.liangfeng.ysdemo.R;
import com.videogo.openapi.bean.EZDeviceInfo;

import java.util.List;

/**
 * Created by mzf on 2017/4/18.
 */
public class MyAdapter extends BaseAdapter {
    List<EZDeviceInfo> datas;
    Context context;
    private TextView tv_deviceName;

    public MyAdapter(Context context,List list) {
        datas = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.item, null);
        tv_deviceName = (TextView) inflate.findViewById(R.id.tv_deviceName);
        tv_deviceName.setText(datas.get(position).getDeviceName());
        return inflate;
    }
}
